package by.msokoloff.javaweb2015.services;

import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.transaction.annotation.Transactional;

import by.msokoloff.javaweb2015.datamodel.City;

public interface CityService {

	City get(Integer id);

	Long getCount();

	List<City> getByField(SingularAttribute<City, ?> attr, Object val);

	long getCountByField(SingularAttribute<City, ?> attr, Object val);

	List<City> getAll();

	List<City> getAll(SingularAttribute<City, ?> attr, boolean ascending, int startRecord, int pageSize);

	List<City> getAll(SingularAttribute<City, ?> filterAttr, Object val, SingularAttribute<City, ?> attr, boolean ascending, int startRecord, int pageSize);

	List<City> getStartingWith(String string, Integer max);
	
	@Transactional
	void createOrUpdate(City city);

	@Transactional
	void delete(City city);

	@Transactional
	void deleteAll();

	@Transactional
	void deleteWithRelations(City city);

}
